<!DOCTYPE HTML>
<html>
<head>
    <include file="Common:header_include"/>
    <title>添加患者</title>
</head>
<body>
<div class="pd-20">
    <form action="{:U('add')}" method="post" class="form form-horizontal" id="form">
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>昵称：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="nick" datatype="*3-10" nullmsg="不能为空">
            </div>
        <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>曾用名：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="usedname" datatype="*2-6" nullmsg="不能为空">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>密码：</label>
            <div class="formControls col-7">
                <input type="password" class="input-text" placeholder="请输入" name="passwd" datatype="*6-18" nullmsg="不能为空" onfocus="this.type='password'">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>密码确认：</label>
            <div class="formControls col-7">
                <input type="password" class="input-text" placeholder="请输入" name="pwd2" datatype="*6-18" nullmsg="不能为空" onfocus="this.type='password'" errormsg="您两次输入的密码不一致！" recheck="passwd">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red"></span>头像：</label>
            <div class="formControls col-7">
                <input type="file" class="input-text" name="coverFile" accept="image/*">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>血型：</label>
            <div class="formControls col-7">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="bloodid" datatype="*" nullmsg="请选择">
                    <option value="" selected="" disabled="disabled">请选择</option>
                    <volist name=":getList(bloodtypeinfo)" id="v">
                        <option value="{$v.id}">{$v.name}</option>
                    </volist>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl" >
            <label class="form-label col-2"><span class="c-red">*</span>省区：</label>
            <div class="formControls col-7">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="provenceID" datatype="*" onchange="onchangeProvince($(this))" nullmsg="请选择" id="provinceid">
                    <option value="" selected="" disabled="disabled">请选择</option>
                    <volist name=":getaerainfoList()" id="v">
                           <option value="{$v['aerainfo_id']}"  <if condition="$data['provenceid'] eq $v['aerainfo_id']">selected</if>>{$v['aerainfo_name']}</option>
                    </volist>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>市区：</label>
            <div class="formControls col-7">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="cityid" datatype="*" nullmsg="请选择"  onchange="onchangecity($(this))" id="city">
                    <option value="" selected="" disabled="disabled">请选择</option>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl" >
            <label class="form-label col-2"><span class="c-red">*</span>区域：</label>
            <div class="formControls col-7">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="regionid" datatype="*" nullmsg="请选择"  id="district">
                    <option value="" selected="" disabled="disabled">请选择</option>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>性别：</label>
            <div class="formControls col-5 skin-minimal">
                <div class="radio-box">
                    <input type="radio" id="sex-1" name="sex" datatype="*" nullmsg="请选择性别！" value="1" checked>
                    <label for="sex-1">男</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="sex-2" name="gender" value="0">
                    <label for="sex-2">女</label>
                </div>
            </div>
            <div class="col-4"> </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>出生日期：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" datatype="*" nullmsg="请选择性别！"  name="birthday" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'});">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>身份证：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="idcard" datatype="*" nullmsg="请选择性别！"  >
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>真实姓名：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="realname" datatype="*">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>手机号：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="phone">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>住址：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="address">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">邮箱：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="email">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">患者的介绍：</label>
            <div class="formControls col-7">
                <script id="content" name="description" type="text/plain" style="width:100%;height:400px;"></script>
                </div>
                <div class="col-4"></div>
     </div>
        <div class="row cl">
            <div class="col-9 col-offset-5">
                <input class="btn btn-primary radius" type="submit" value="提交">
            </div>
        </div>
    </form>
</div>
</div>
<include file="Common:footer_include"/>
<script>
    $(function () {
        var ue = UE.getEditor('content');
    });
    function onchangeDepartment(jqObj){
        var department_id = jqObj.val();
        var diseaseBox = $('#disease');
        diseaseBox.html('');
        $.ajax({
            url: '{:U("Disease/getListJson")}?department_id=' + department_id,
            type: 'post',
            enctype: 'multipart/form-data',
            success: function (data) {
                $.each(data, function (i, item) {
//                    diseaseSelect.append('<option value="' + item.id + '" >' + item.title + '</option>');
                    var diseaseHtml="<div class='skin-minimal check-box' style='width: 200px;margin-top: 5px'> <div class='check-box'> <input type='checkbox' name='disease_id[]' value='"+item.id+"'>"+item.title+"</div> </div>";
                    diseaseBox.append(diseaseHtml);
                });
            }
        });
    }
    function onchangeProvince(jqObj){
        var province_id = jqObj.val();
        var citycheck = $('#city');
        citycheck.html('');
        $.ajax({
            url: '{:U("Hospitalinfo/getCityListJson")}?province_id=' + province_id,
            type: 'post',
            enctype: 'multipart/form-data',
            success: function (data) {
                $.each(data, function (i, item) {
                    citycheck.append('<option value="' + item.aerainfo_id + '" >' + item.aerainfo_name + '</option>');
//                    var diseaseHtml="<div class='skin-minimal check-box' style='width: 200px;margin-top: 5px'> <div class='check-box'> <input type='checkbox' name='disease_id[]' checked value='"+item.id+"'>"+item.title+"</div> </div>";
//                    diseaseBox.append(diseaseHtml);
                });
                onchangecity(citycheck);
            }
        });

    }
    function onchangecity(jqObj){
        var city_id = jqObj.val();
        var districtcheck = $('#district');
        var ajaxurl='{:U("Hospitalinfo/getDistrictJson")}?city_id=' + city_id;
        districtcheck.html('');
        $.ajax({
            url:ajaxurl ,
            type: 'post',
            enctype: 'multipart/form-data',
            success: function (data) {
                $.each(data, function (i, items) {
                    districtcheck.append('<option value="'+ items.aerainfo_id + '" >'+ items.aerainfo_name + '</option>');
                });
            }
        });
    }
</script>
</body>
</html>